/* GUI CONVERTED from rcrsoup.p (converter v1.75) Sat Aug 12 23:00:56 2000 */
/* rcrsoup.p - Customer Schedules : Update Header in Ship-From Database      */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                       */
/* All rights reserved worldwide.  This is an unpublished work.              */
/*V8:ConvertMode=Maintenance                                                 */
/*V8:RunMode=Character,Windows                                               */
/* REVISION: 7.3      LAST MODIFIED: 08/13/93   BY: WUG *GB74*               */
/* REVISION: 7.3      LAST MODIFIED: 08/30/93   BY: WUG *GE19*               */
/* REVISION: 7.3      LAST MODIFIED: 04/11/95   BY: ame *F0QB*               */
/* REVISION: 7.3      LAST MODIFIED: 08/02/95   BY: bcm *G0TB*               */
/* REVISION: 8.6      LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan        */
/* Old ECO marker removed, but no ECO header exists *F0PN*                   */
/* REVISION: 8.6E     LAST MODIFIED: 07/15/98   BY: *L024* Bill Reckard      */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 07/05/00   BY: *N0F0* Arul Victoria   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb               */

         /* UPDATE REMOTE DATABASE SO HEADER RECORD */

         {mfdeclre.i}
         {gplabel.i} /* EXTERNAL LABEL INCLUDE */

         define input parameter so_recid as recid.

         define variable old_db as character.
         define new shared frame hf_so_mstr.
         define stream nullstream.
         define variable sdb_err as integer no-undo.
         define     shared variable order-shipfrom like scx_shipfrom no-undo.

/*L024*/ define new shared temp-table tt_exru_usage like exru_usage.

         FORM /*GUI*/ 
            so_mstr
            except so_conrep so_inv_mthd
         with overlay frame hf_so_mstr THREE-D /*GUI*/.


         FORM /*GUI*/ 
            so_conrep format "x(40)"
            so_inv_mthd format "x(40)"
         with overlay frame hf_so_mstr THREE-D /*GUI*/.


/*N0F0* ------------------- BEGIN DELETE ----------------------- *
 *       /* DELETE setFrameLabels as the frame is not used for display */
 *       /* It is a buffer causes "Array subscript 61 is out of range" error */
 *
 *       /* SET EXTERNAL LABELS */
 *        setFrameLabels(frame hf_so_mstr:handle).
 *N0F0* ------------------- END   DELETE ----------------------- */

         find so_mstr where recid(so_mstr) = so_recid no-lock.

         find si_mstr where si_site = order-shipfrom no-lock.

         if si_db <> global_db then do:
            do with frame hf_so_mstr:
               {mfoutnul.i &stream_name=nullstream}
               display stream nullstream so_mstr with frame hf_so_mstr.
               output stream nullstream close.
            end.

/*L024*/    /* Need to copy usage records, but mc-copy-ex-rate-usage doesn't */
/*L024*/    /* work across databases, so the following is necessary.         */
/*L024*/    /* Clean out temp table and copy all exru_usage to it, for use   */
/*L024*/    /* later in rcrsoupa. */

/*L024*/    for each tt_exru_usage exclusive-lock:
/*L024*/       delete tt_exru_usage.
/*L024*/    end. /* for each tt_exru_usage */
/*L024*/    for each exru_usage no-lock
/*L024*/       where exru_usage.exru_seq = so_exru_seq:
/*L024*/       buffer-copy exru_usage to tt_exru_usage.
/*L024*/       if recid(tt_exru_usage) = -1 then.
/*L024*/    end. /* for each exru_usage */

            old_db = global_db.
            {gprun.i ""gpalias3.p"" "(input si_db, output sdb_err)"}
/*GUI*/ if global-beam-me-up then undo, leave.

            {gprun.i ""rcrsoupa.p""}
/*GUI*/ if global-beam-me-up then undo, leave.

            {gprun.i ""gpalias3.p"" "(input old_db, output sdb_err)"}
/*GUI*/ if global-beam-me-up then undo, leave.

         end.
